package com.example.piece.ui.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.databinding.ViewDataBinding
import com.therouter.router.Autowired
import com.therouter.router.Route
import com.example.base.tools.JsonTool
import com.example.piece.BR
import com.example.piece.R
import com.example.piece.constant.Key
import com.example.piece.constant.RoutePath
import com.example.piece.databinding.ActivitySystemMsgDetailBinding
import com.example.piece.databinding.ItemSystemMsgBinding
import com.example.piece.entity.UserMessageSystemEntity

/**
 * 消息详情
 */
@Route(path = RoutePath.MAIN_SYSTEM_MSG_DETAIL_ACTIVITY)
class SystemMsgDetailActivity : Layer3Activity<ActivitySystemMsgDetailBinding,ViewDataBinding>() {
    override val isTransparentStatusBar: Boolean = true
    override val isLockPortrait: Boolean = true
    override val statusBarAlpha: Int = 0
    override val isDarkMode: Boolean = true
    override val isFitsSystemWindows: Boolean = true
    override val leftIcon1Res: Int = R.drawable.ic_back
    override val centerLayoutRes: Int
        get() =R.layout.activity_system_msg_detail
    override val title: String
        get() = H5_TITLE

    @JvmField
    @Autowired(name = Key.DataKey.H5_TITLE)
    var H5_TITLE: String = ""
    @JvmField
    @Autowired(name = Key.DataKey.MSG_CONTENT)
    var MSG_CONTENT: String = ""



    override fun onClickLeftIcon1(view: View) {
        onBackPressed()

    }

    override fun initData(savedInstanceState: Bundle?) {
        super.initData(savedInstanceState)
        val json2Object = JsonTool.parseObject<UserMessageSystemEntity>(MSG_CONTENT, UserMessageSystemEntity::class.java)
        mCenterViewBinding?.setVariable(BR.entity,json2Object)
        mCenterViewBinding?.executePendingBindings()
    }

}